//the frist cpp.
#include<bits/stdc++.h>
using namespace std;
struct student
{
    int mark[10];
    char name[10];
}student[10];
int main()
{
    for(int i = 1; i <=10 ; i++)
    {
        cin>>student[i].name>>student[i].mark;
    }
    for(int i = 1; i <= 10 ; i++)
    for(int j = 1 ; j <= 10; j++)
    {
        if(student[j].mark < strudent[j+1])
        {
            swap(student[j].mark,student[j+1].mark);
            swap(student[j].name,student[j+1].name);
        }
    }
    for(int i = 1; i <=10 ; i++)
    {
        cout<<student[i].name<<" "<<student[i].mark<<endl;
    }
}